package work20241125;

import java.util.Scanner;

/**
 * @author zdl
 * @date 2024/11/25
 */
public class Demo11 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入月份:");
        int month = sc.nextInt();
        day(month);
    }
    //8、根据输入的月份，判断该月份有多少天
    public static void day(int month){
        switch (month){
            case 1:
            case 3:
            case 5:
            case 7:
            case 8:
            case 10:
            case 12:
                System.out.println(month+"月有31天");
                break;
            case 4:
            case 6:
            case 9:
            case 11:
                System.out.println(month+"月有30天");
                break;
            case 2:
                //不判断年份，默认2月29天
                System.out.println(month+"月有29天");
                break;
        }
    }
}
